<!--
 * @Author: Bennty
 * @Date: 2024-05-17 20:04:46
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-07-15 10:17:52
 * @Description: 请填写简介
-->
<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
      :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div class="search" v-show="showSearch">
        <el-form :model="queryParams" :label-width="100" ref="queryFormRef" :inline="true">
          <el-form-item label="任务名称" prop="projectName">
            <el-input style="width: 130px;" v-model="queryParams.projectName" placeholder="请输入任务名称" clearable @keyup.enter="handleQuery" />
          </el-form-item>
          <el-form-item label="项目类型" prop="projectTypeId">
            <!--            <el-input v-model="queryParams.projectTypeId" placeholder="请输入项目类型(取字典)" clearable @keyup.enter="handleQuery" />-->
            <el-select style="width: 130px;" v-model="queryParams.projectTypeId">
              <el-option v-for="item in projectType" :key="item.dictCode" :label="item.dictValue"
                :value="item.dictCode" />
            </el-select>
          </el-form-item>

          <el-form-item label="创建人" prop="createByName">
            <el-input style="width: 130px;" v-model="queryParams.createByName" placeholder="请输入创建人" clearable @keyup.enter="handleQuery" />
          </el-form-item>

          <el-form-item label="总工时" prop="totalWorkHours">
            <el-input style="width: 130px;" v-model="queryParams.totalWorkHours" placeholder="请输入总工时" clearable @keyup.enter="handleQuery" />
          </el-form-item>
          <el-form-item label="开始时间" prop="date">
            <el-date-picker v-model="queryParams.date" type="month" placeholder="选择月份" format="YYYY-MM" value-format="YYYY-MM" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <!--        <el-row :gutter="10" class="mb8">-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['sj:designProject:add']">新增</el-button>-->
        <!--          </el-col>-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['sj:designProject:edit']"-->
        <!--              >修改</el-button-->
        <!--            >-->
        <!--          </el-col>-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['sj:designProject:remove']"-->
        <!--              >删除</el-button-->
        <!--            >-->
        <!--          </el-col>-->
        <!--          <el-col :span="1.5">-->
        <!--            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['sj:designProject:export']">导出</el-button>-->
        <!--          </el-col>-->
        <!--          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>-->
        <!--        </el-row>-->
        <el-row>
          <el-col :span="5">
            <el-button type="primary" plain icon="Plus" @click="handleAdd"
              v-hasPermi="['sj:designProject:add']">新增</el-button>
              <el-button type="warning" plain icon="Edit" 
              v-hasPermi="['sj:designProject:edit']" @click="handleUpdate">编辑</el-button>
          </el-col>
          <!-- <el-col :span="5">
            
          </el-col> -->
          <el-col :span="13">
            <template v-if="!role.includes('Designer')">
              <div class="project-Number" v-if="doingProject.length !== 0">{{ `当前有${doingProject.length}个进行中的项目` }}</div>
              <div class="project-Number" v-else>{{ `当前暂无进行的项目` }}</div>
            </template>
            <template v-else>
              <div class="project-Number" v-if="doingProject.length !== 0">{{ `当前进行的项目：${doingProject[0].projectName}` }}
              </div>
              <div class="project-Number" v-else>{{ `当前暂无进行的项目` }}</div>
            </template>
          </el-col>
          <el-col :span="6">
            <el-button type="danger" @Click="handleClickStopToday">结束今日</el-button>
            <el-button type="primary">查看信息</el-button>
            <el-button type="primary">历史记录</el-button>
          </el-col>
        </el-row>
      </template>

      <el-table v-loading="loading" :data="designProjectList" highlight-current-row @current-change="handleCurrentChange" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="主键" align="center" prop="id" v-if="false" />
        <el-table-column label="任务名称" align="center" prop="projectName">
          <template #default="scope">
            <span class="project-name" @click="handleCheckProject(scope.row)">{{ scope.row.projectName }}</span>
          </template> </el-table-column>>
        <el-table-column label="项目类型" align="center" prop="projectTypeId">
          <template #default="scope">
            <span>{{
              projectType.filter((item) => item.dictCode == scope.row.projectTypeId)[0]?.dictValue
            }}</span>
            <!-- <span>{{ projectType }}</span> -->
          </template> </el-table-column>>
        <el-table-column label="状态" align="center" prop="status">
          <template #default="scope">
            <span v-if="scope.row.status == '0'" class="status-not-begin">未开始</span>
            <span v-else-if="scope.row.status == '1'" class="status-doing">进行中</span>
            <span v-else-if="scope.row.status == '2'" class="status-pause">已暂停</span>
            <span v-else-if="scope.row.status == '3'" class="status-finished">已结束</span>
          </template>
        </el-table-column>
        <!--        <el-table-column label="项目类型" align="center" prop="projectType" />-->
        <el-table-column label="总工时" align="center">
          <template #default="scope">
            <span>{{ `${parseInt(scope.row.totalWorkHoursStr.split(':')[0], 10) || 0}小时` }}</span>
          </template>
        </el-table-column>
        <el-table-column label="已用时长" align="center" prop="completeWorkHoursStr"> </el-table-column>
        <el-table-column label="创建人" align="center" prop="createByName" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <!--            <el-tooltip content="开始任务" placement="top">-->
            <!--              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['sj:designProject:edit']"></el-button>-->
            <!--            </el-tooltip>-->

            <el-button type="primary" :loading="handleButtonLoading" size="small"
              v-if="scope.row.status == '0' || scope.row.status == '2'"
              @click="handleClickStart(scope.row)">开始任务</el-button>
            <el-button type="warning" :loading="handleButtonLoading" size="small" v-if="scope.row.status == '1'"
              @click="handleClickPause(scope.row)">暂停任务</el-button>
            <el-button type="danger" :loading="handleButtonLoading" size="small" @click="handleClickFinish(scope.row)"
              v-if="scope.row.status == '1'">结束任务</el-button>
            <el-tooltip content="删除" placement="top" v-if="scope.row.status == '3'">
              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
                v-hasPermi="['sj:designProject:remove']"></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>
    <!-- 添加或修改设计任务项目对话框 -->
    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
      <el-form ref="designProjectFormRef" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="任务名称" prop="projectName">
          <el-input v-model="form.projectName" placeholder="请输入任务名称" />
        </el-form-item>
        <el-form-item label="项目类型" prop="projectTypeId">
          <!--          <el-input v-model="form.projectTypeId" placeholder="请输入项目类型(取字典)" />-->
          <el-select style="width: 100%" v-model="form.projectTypeId">
            <el-option v-for="item in projectType" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode" />
          </el-select>
        </el-form-item>

        <el-form-item label="创建人" prop="createByName">
          <el-input disabled v-model="form.createByName" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="总工时" prop="totalWorkHours">
          <el-input :disabled="isPresetTime" v-model.number="form.totalWorkHours" placeholder="请输入总工时" />
        </el-form-item>
        <!-- <el-form-item label="创建人" prop="createByName">
          <el-input disabled v-model="form.createByName"></el-input>
        </el-form-item> -->
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- 结束或暂停设计任务项目对话框 -->
    <el-dialog :title="handleDesignDialog.title" v-model="handleDesignDialog.visible" width="500px" append-to-body>
      <el-form v-model="handleDesignProjectForm">
        <el-form-item label="任务名称">
          <span>{{ projectInfo?.projectName }}</span>
        </el-form-item>
        <el-form-item label="任务时长">
          <span>{{ `${parseInt(projectInfo?.totalWorkHoursStr.split(':')[0], 10) || 0}小时` }}</span>
        </el-form-item>
        <el-form-item label="已用时长">
          <span>{{ `${surplusWorkHoursStr}` }}</span>
        </el-form-item>
        <el-form-item label="首次开始时间">
          <span>{{ timeRecord[0].time }}</span>
        </el-form-item>
        <!-- <el-form-item label="结束时间" v-if="handleDesignDialog.title=='结束任务'">
          <span>{{timeRecord[1].time}}</span>
        </el-form-item> -->
        <el-form-item label="备注信息" prop="remark">
          <el-input v-model="handleDesignProjectForm.remark" type="textarea" placeholder="请输入" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" :loading="submitLoading" @click="submitHandleProject">确 定</el-button>
          <el-button :loading="submitLoading" @click="cancelHandleProject">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="checkDesignDialog.visible" :title="checkDesignDialog.title" width="500px"
      @close="handleCloseTimeDetail" append-to-body>
      <el-table :data="projectInfoTableData">
        <el-table-column label="任务名称" align="center" prop="projectName" />
        <el-table-column label="设定时间" align="center" prop="totalWorkHoursStr" />
        <el-table-column label="已用时间" align="center" prop="completeWorkHoursStr" />
        <el-table-column label="用时详情" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-button type="primary" :disabled="isGetTimeDetail" @click="checkTimeDetail(scope.row)">获取</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-collapse v-if="isGetTimeDetail">
        <el-collapse-item title="工作详情">
          <el-descriptions v-for="item in timeRecord" :key="item.time">
            <el-descriptions-item :label="item.recordName">{{ item.time }}</el-descriptions-item>
          </el-descriptions>
          <h2 v-if="timeRecord.length === 0">该项目未开始</h2>
        </el-collapse-item>
      </el-collapse>
    </el-dialog>
    <el-dialog v-model="stopTodayDialog.visible" :title="stopTodayDialog.title" width="600px" @close="handleCloseEnd"
      append-to-body>
      <el-table v-loading="stopTodayDialog.tableLoading" :data="endTodayData">
        <el-table-column label="任务名称" align="center" prop="projectName" />
        <el-table-column label="项目类型" align="center" prop="projectType" />
        <el-table-column label="总工时" align="center" prop="totalWorkHoursStr">
          <template #default="scope">
            <span>{{ `${parseInt(scope.row.totalWorkHoursStr.split(':')[0], 10) || 0}小时` }}</span>
          </template>
        </el-table-column>
        <el-table-column label="今日已用工时" align="center" prop="todayCompleteWorkHoursStr" />
        <el-table-column label="总共已用工时" align="center" prop="completeWorkHoursStr" />
        <el-table-column label="创建人" align="center" prop="createByName" />
      </el-table>
      <template #footer>
        <div class="sotpToday-dialog-footer">
          <span class="spend-time">今日用时:{{ stopTodayDialog.totalSpendTime }}小时</span>
          <el-button type="primary" @click="handleCloseEnd">确认结束</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="DesignProject" lang="ts">
import { listDesignProject, getDesignProject, delDesignProject, addDesignProject, updateDesignProject, startDesignProject, checkDoingProject, pauseDesignProject, finishDesignProject, checkProjectTime, stopToday } from '@/api/sj/designProject';
import { DesignProjectVO, DesignProjectQuery, DesignProjectForm, PauseProjectDesignForm, TimeRecord } from '@/api/sj/designProject/types';
import { getDicts } from "@/api/system/dict/data";
import { DictDataVO } from "@/api/system/dict/data/types";
import { useUserStore } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

const userStore = useUserStore();
const role = userStore.roles;
const creater = userStore.name;
console.log(userStore,'111111111111111');

const projectType = ref<DictDataVO[]>([]);
const doingProject = ref<DictDataVO[]>([]);

const designProjectList = ref<DesignProjectVO[]>([]);
const isPresetTime = ref<boolean>(false);
const buttonLoading = ref(false);
const handleButtonLoading = ref(false);
const submitLoading = ref(false);
const surplusWorkHoursStr = ref<string>('');
const isGetTimeDetail = ref(false)
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const designProjectFormRef = ref<ElFormInstance>();
// const projectInfo = ref<DesignProjectVO>();
const projectInfo = ref();
const projectInfoTableData = ref<DesignProjectVO[]>([]);
const endTodayData = ref<DesignProjectVO[]>();
const currentRow = ref()

const createByName = ref();

const handleCurrentChange = (val: any | undefined) => {
  currentRow.value = val
}


const handleDesignProjectForm = reactive<PauseProjectDesignForm>({
  id: undefined,
  remark: ''
})

const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});

const stopTodayDialog = reactive({
  visible: false,
  title: '结束今日',
  tableLoading: false,
  totalSpendTime: 0
})

const handleDesignDialog = reactive({
  visible: false,
  title: ''
});

const timeRecord = ref<TimeRecord[]>([]);

const checkDesignDialog = reactive({
  visible: false,
  title: '工作详情',
})

const initFormData: DesignProjectForm = {
  projectName: undefined,
  projectTypeId: undefined,
  createByName: undefined,
  projectType: undefined,
  totalWorkHours: undefined,
  id: undefined
  // createByName: creater || undefined

}


const checkWorkHours = (rule: any, value: any, callback: any) => {
  if (!value) {
    return callback(new Error('输入工时'));
  } else if (value < 1) {
    return callback(new Error('工时必须大于1小时'))
  } else {
    callback();
  }
};

const data = reactive<PageData<DesignProjectForm, DesignProjectQuery>>({
  form: { ...initFormData },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    createByName: undefined,
    projectName: undefined,
    projectTypeId: undefined,
    projectType: undefined,
    totalWorkHours: undefined,
    date: undefined,
    params: {
    }
  },
  rules: {
    projectName: [
      { required: true, message: '输入任务单名称', trigger: 'blur' },
    ],
    projectTypeId: [
      { required: true, message: '选择项目类型', trigger: 'blur' },
    ],
    totalWorkHours: [
      { required: true, message: '输入工时', trigger: 'blur' },
      { validator: checkWorkHours, trigger: 'blur' },
      { type: 'number', message: '工时必须是数字', trigger: 'change' },
    ],

    createByName: [
      { required: true, message: '输入创建人', trigger: 'blur' },
    ],
  }
});

const { queryParams, form, rules } = toRefs(data);

/** 获取有多少在进行的任务 */
const getDoingProjectNumbers = async () => {
  const res = await checkDoingProject()
  doingProject.value = res.data;
}

/** 获取项目类型 */
const getProjectType = async () => {
  const res = await getDicts('design_type');
  projectType.value = res?.data;
}

/** 查询设计任务项目列表 */
const getList = async () => {
  loading.value = true;
  const res = await listDesignProject(queryParams.value);
  designProjectList.value = res.rows;
  total.value = res.total;
  loading.value = false;
}



/** 结束今日 */
const endToday = async () => {
  stopTodayDialog.tableLoading = true;
  const res = await stopToday();
  endTodayData.value = res.data;
  stopTodayDialog.tableLoading = false;
  const time = [0, 0];
  const totalUseArray = res.data.reduce((prev: any, current: any) => {
    const hour = prev[0] + parseInt(current.todayCompleteWorkHoursStr.split(':')[0]);
    const min = prev[1] + parseInt(current.todayCompleteWorkHoursStr.split(':')[1]);
    return [hour, min]
  }, time);
  const minute = totalUseArray[0] * 60 + totalUseArray[1];
  const totalSpendTime = (minute / 60).toFixed(2)
  stopTodayDialog.totalSpendTime = parseFloat(totalSpendTime);
}

const handleCloseEnd = () => {
  stopTodayDialog.visible = false;
  getList();
  getDoingProjectNumbers();
}

/** 取消按钮 */
const cancel = () => {
  reset();
  dialog.visible = false;
}

/** 表单重置 */
const reset = () => {
  form.value = { ...initFormData };
  designProjectFormRef.value?.resetFields();
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value?.resetFields();
  handleQuery();
}

/** 多选框选中数据 */
const handleSelectionChange = (selection: DesignProjectVO[]) => {
  ids.value = selection.map(item => item.id || 0);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 点击结束今日按钮 */
const handleClickStopToday = () => {
  stopTodayDialog.visible = true;
  endToday();
}

/** 检查项目详情 */
const handleCheckProject = async (row?: DesignProjectVO) => {
  const _id = row?.id || ids.value[0];
  await getDesignProject(_id).then((res) => {
    projectInfoTableData.value = [res.data];
    checkDesignDialog.visible = true;
  });
}

/** 查看用时详情 */
const checkTimeDetail = async (row?: DesignProjectVO) => {
  const _id = row?.id || ids.value[0];
  await checkProjectTime(_id).then(
    (res) => {
      timeRecord.value = res.data;
      isGetTimeDetail.value = true;
    }
  )
}

/**关闭查看详情对话框*/
const handleCloseTimeDetail = () => {
  isGetTimeDetail.value = false;
  timeRecord.value = [];
}

/** 新增按钮操作 */
const handleAdd = () => {
  reset();
  dialog.visible = true;
  dialog.title = "添加设计任务项目";
  form.value.createByName = creater
}


/** 检测选择的项目类型*/
watch(data, (newValue, oldValue) => {
  designProjectFormRef?.value?.clearValidate();
  console.log(newValue.form.projectTypeId)
  const selectedProjectType = projectType.value.filter((item) => item.dictCode == newValue.form.projectTypeId)[0];
  if (selectedProjectType) {
    oldValue.form.projectType = selectedProjectType.dictValue;
    if (selectedProjectType.remark) {
      isPresetTime.value = true;
      oldValue.form.totalWorkHours = parseInt(selectedProjectType.remark);
    } else {
      isPresetTime.value = false;

    };
  };
})

/** 开始项目 */
const handleClickStart = async (row?: DesignProjectVO) => {
  handleButtonLoading.value = true;
  const _id = row?.id || ids.value[0];
  await startDesignProject(_id).then(
    () => {
      getList();
      handleButtonLoading.value = false;
      getDoingProjectNumbers();
    },
    (error) => {
      console.log(error);
      handleButtonLoading.value = false;
    }
  )
}

/** 暂停项目 */
const handleClickPause = async (row?: DesignProjectVO) => {
  const _id = row?.id || ids.value[0];
  await checkProjectTime(_id).then(
    (res) => {
      timeRecord.value = res.data;
    }
  )
  await getDesignProject(_id).then((res) => {
    projectInfo.value = res.data;
  });
  handleDesignProjectForm.id = _id;
  handleDesignDialog.title = '暂停任务';
  handleDesignDialog.visible = true;
}

/** 结束项目 */
const handleClickFinish = async (row?: DesignProjectVO) => {
  const _id = row?.id || ids.value[0];
  // checkTime(_id);
  surplusWorkHoursStr.value = row?.completeWorkHoursStr || '0';
  await getDesignProject(_id).then((res) => {
    projectInfo.value = res.data;
  });
  await checkProjectTime(_id).then(
    (res) => {
      timeRecord.value = res.data;
      // const timeList = res.data.map((item:any)=>{
      //   return Date.parse(item.time)/1000
      // });
      // let timeGroup = [];
      // for(let i=0;i<timeList.length;i+=2){
      //   timeGroup.push(timeList.slice(i,i+2));
      // };
      // timeGroup[timeGroup.length-1].push(new Date().getTime()/1000);
      // let timeDifferList = timeGroup.map((item)=>{
      //   return item[1]-item[0]
      // })
      // const timeDiffer = timeDifferList.reduce((pre,cur)=>{
      //   return pre+cur
      // },0)
      // surplusWorkHoursStr.value = Math.round(timeDiffer/60/60*100)/100;
      // console.log(timeDiffer);
    }
  )
  handleDesignProjectForm.id = _id;
  handleDesignDialog.title = '结束任务';
  handleDesignDialog.visible = true;
}

/** 提交暂停/结束 */
const submitHandleProject = async () => {
  submitLoading.value = true;
  if (handleDesignDialog.title === '暂停任务') {
    await pauseDesignProject(handleDesignProjectForm).then(
      () => {
        handleDesignDialog.visible = false;
        getList();
        submitLoading.value = false;
        getDoingProjectNumbers();
      },
      (error) => {
        console.log(error);
        submitLoading.value = false;
      }
    );
  } else if (handleDesignDialog.title === '结束任务') {
    await finishDesignProject(handleDesignProjectForm).then(
      () => {
        handleDesignDialog.visible = false;
        getList();
        submitLoading.value = false;
        getDoingProjectNumbers();
      },
      (error) => {
        console.log(error);
        submitLoading.value = false;
      }
    );
  }
}



/** 取消暂停/结束 */
const cancelHandleProject = () => {
  handleDesignDialog.visible = false;
  handleDesignProjectForm.id = '';
  handleDesignProjectForm.remark = '';
}

/** 修改按钮操作 */
const handleUpdate = async (row?: DesignProjectVO) => {
  if(currentRow.value){
    console.log(row);
    reset();
    // const _id = row?.id || ids.value[0]
    const _id = currentRow.value.id;
    const res = await getDesignProject(_id);
    Object.assign(form.value, res.data);
    console.log(form.value);
    dialog.visible = true;
    dialog.title = "修改设计任务项目";
  }else{
    proxy?.$modal.msgWarning("选择要编辑的任务");
  }
  
}

/** 提交按钮 */
const submitForm = () => {
  designProjectFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id) {
        await updateDesignProject(form.value).finally(() => {
          buttonLoading.value = false;
          proxy?.$modal.msgSuccess("编辑成功");
        });
      } else {
        await addDesignProject(form.value).finally(() => {
          buttonLoading.value = false;
          proxy?.$modal.msgSuccess("新增成功");
        });
      }
      
      dialog.visible = false;
      await getList();
      getDoingProjectNumbers();
    }
  });
}

/** 删除按钮操作 */
const handleDelete = async (row?: DesignProjectVO) => {
  const _ids = row?.id || ids.value;
  const name = row?.projectName;
  await proxy?.$modal.confirm('是否确认删除设计任务名称为"' + name + '"的数据项？').finally(() => loading.value = false);
  await delDesignProject(_ids);
  proxy?.$modal.msgSuccess("删除成功");
  await getList();
  getDoingProjectNumbers();
}

/** 导出按钮操作 */
const handleExport = () => {
  proxy?.download('sj/designProject/export', {
    ...queryParams.value
  }, `designProject_${new Date().getTime()}.xlsx`)
}

onMounted(() => {
  getList();
  getProjectType();
  getDoingProjectNumbers();
});
</script>

<style scoped lang="scss">
.search{
  padding: 10px 10px 10px 10px;
}
.project-name {
  &:hover {
    cursor: pointer;
    color: #409EFF
  }
}

.sotpToday-dialog-footer {
  display: flex;
  justify-content: space-between;
}

.project-Number {
  font-size: 30px;
}

.status-not-begin {
  color: #FF0000
}

.status-doing {
  color: #409EFF
}

.status-pause {
  color: #E6A23C
}

.status-finished {
  color: #3C9511
}

// .el-input__wrapper{
//   width: 130px !important;
// }
</style>
